/**
 * Copyright (C) 2018-2021
 * All rights reserved, Designed By www.yixiang.co

 */
package co.yixiang.modules.product.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import co.yixiang.serializer.BigDecimalSerializer;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;
import java.math.BigDecimal;

/**
* @author hupeng
* @date 2020-05-12
*/

@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
@TableName("yx_store_product_attr_value")
public class YxStoreProductAttrValue implements Serializable {

    @TableId
    private Long id;


    /** 商品ID */
    @ApiModelProperty(value = "商品ID")
    private Long productId;


    /** 商品属性索引值 (attr_value|attr_value[|....]) */
    @ApiModelProperty(value = "商品属性索引值 (attr_value|attr_value[|....])")
    private String sku;


    /** 属性对应的库存 */
    @ApiModelProperty(value = "属性对应的库存")
    private Integer stock;

    /** 拼团库存属性对应的库存 */
    @ApiModelProperty(value = "拼团库存属性对应的库存")
    private Integer pinkStock;

    /** 秒杀库存属性对应的库存 */
    @ApiModelProperty(value = "秒杀库存属性对应的库存")
    private Integer seckillStock;

    /** 销量 */
    @ApiModelProperty(value = "销量")
    private Integer sales;


    /** 属性金额 */
    @ApiModelProperty(value = "属性金额")
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal price;

    /** 拼团属性对应的金额 */
    @ApiModelProperty(value = "拼团属性对应的金额")
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal pinkPrice;

    /** 秒杀属性对应的金额 */
    @ApiModelProperty(value = "秒杀属性对应的金额")
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal seckillPrice;

    /** 图片 */
    @ApiModelProperty(value = "属性对应的图片")
    private String image;


    /** 唯一值 */
     @TableField(value = "`unique`")
     @ApiModelProperty(value = "唯一值")
    private String unique;


    /** 成本价 */
    @ApiModelProperty(value = "成本价")
    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal cost;

    /** 商品条码 */
    @ApiModelProperty(value = "商品条码")
    private String barCode;

    /** 原价 */
    @ApiModelProperty(value = "原价")
    private BigDecimal otPrice;

    /** 重量 */
    @ApiModelProperty(value = "重量")
    private BigDecimal weight;

    /** 体积 */
    @ApiModelProperty(value = "体积")
    private BigDecimal volume;


    /** 一级返佣 */
    @ApiModelProperty(value = "一级返佣")
    private BigDecimal brokerage;

    /** 二级返佣 */
    @ApiModelProperty(value = "二级返佣")
    private BigDecimal brokerageTwo;

    /** 所需多少积分兑换商品 */
    @ApiModelProperty(value = "所需多少积分兑换商品")
    private Integer integral;

    public static YxStoreProductAttrValueBuilder builder() {
        return new YxStoreProductAttrValueBuilder();
    }


    public void copy(YxStoreProductAttrValue source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }

    public static class YxStoreProductAttrValueBuilder {
        private Long id;
        private Long productId;
        private String sku;
        private Integer stock;
        private Integer pinkStock;
        private Integer seckillStock;
        private Integer sales;
        private BigDecimal price;
        private BigDecimal pinkPrice;
        private BigDecimal seckillPrice;
        private String image;
        private String unique;
        private BigDecimal cost;
        private String barCode;
        private BigDecimal otPrice;
        private BigDecimal weight;
        private BigDecimal volume;
        private BigDecimal brokerage;
        private BigDecimal brokerageTwo;
        private Integer integral;

        YxStoreProductAttrValueBuilder() {
        }

        public YxStoreProductAttrValueBuilder id(Long id) {
            this.id = id;
            return this;
        }

        public YxStoreProductAttrValueBuilder productId(Long productId) {
            this.productId = productId;
            return this;
        }

        public YxStoreProductAttrValueBuilder sku(String sku) {
            this.sku = sku;
            return this;
        }

        public YxStoreProductAttrValueBuilder stock(Integer stock) {
            this.stock = stock;
            return this;
        }

        public YxStoreProductAttrValueBuilder pinkStock(Integer pinkStock) {
            this.pinkStock = pinkStock;
            return this;
        }

        public YxStoreProductAttrValueBuilder seckillStock(Integer seckillStock) {
            this.seckillStock = seckillStock;
            return this;
        }

        public YxStoreProductAttrValueBuilder sales(Integer sales) {
            this.sales = sales;
            return this;
        }

        public YxStoreProductAttrValueBuilder price(BigDecimal price) {
            this.price = price;
            return this;
        }

        public YxStoreProductAttrValueBuilder pinkPrice(BigDecimal pinkPrice) {
            this.pinkPrice = pinkPrice;
            return this;
        }

        public YxStoreProductAttrValueBuilder seckillPrice(BigDecimal seckillPrice) {
            this.seckillPrice = seckillPrice;
            return this;
        }

        public YxStoreProductAttrValueBuilder image(String image) {
            this.image = image;
            return this;
        }

        public YxStoreProductAttrValueBuilder unique(String unique) {
            this.unique = unique;
            return this;
        }

        public YxStoreProductAttrValueBuilder cost(BigDecimal cost) {
            this.cost = cost;
            return this;
        }

        public YxStoreProductAttrValueBuilder barCode(String barCode) {
            this.barCode = barCode;
            return this;
        }

        public YxStoreProductAttrValueBuilder otPrice(BigDecimal otPrice) {
            this.otPrice = otPrice;
            return this;
        }

        public YxStoreProductAttrValueBuilder weight(BigDecimal weight) {
            this.weight = weight;
            return this;
        }

        public YxStoreProductAttrValueBuilder volume(BigDecimal volume) {
            this.volume = volume;
            return this;
        }

        public YxStoreProductAttrValueBuilder brokerage(BigDecimal brokerage) {
            this.brokerage = brokerage;
            return this;
        }

        public YxStoreProductAttrValueBuilder brokerageTwo(BigDecimal brokerageTwo) {
            this.brokerageTwo = brokerageTwo;
            return this;
        }

        public YxStoreProductAttrValueBuilder integral(Integer integral) {
            this.integral = integral;
            return this;
        }

        public YxStoreProductAttrValue build() {
            return new YxStoreProductAttrValue(id, productId, sku, stock, pinkStock, seckillStock, sales, price, pinkPrice, seckillPrice, image, unique, cost, barCode, otPrice, weight, volume, brokerage, brokerageTwo, integral);
        }

        public String toString() {
            return "YxStoreProductAttrValue.YxStoreProductAttrValueBuilder(id=" + this.id + ", productId=" + this.productId + ", sku=" + this.sku + ", stock=" + this.stock + ", pinkStock=" + this.pinkStock + ", seckillStock=" + this.seckillStock + ", sales=" + this.sales + ", price=" + this.price + ", pinkPrice=" + this.pinkPrice + ", seckillPrice=" + this.seckillPrice + ", image=" + this.image + ", unique=" + this.unique + ", cost=" + this.cost + ", barCode=" + this.barCode + ", otPrice=" + this.otPrice + ", weight=" + this.weight + ", volume=" + this.volume + ", brokerage=" + this.brokerage + ", brokerageTwo=" + this.brokerageTwo + ", integral=" + this.integral + ")";
        }
    }
}
